import uvicorn
from fastapi import FastAPI, Query
from pydantic import BaseModel
from enum import Enum
from typing import Union, List


class Item(BaseModel):
    name: str
    description: str | None = None
    price: float
    tax: float | None = None


app = FastAPI()  # 创建应用实例



@app.get("/items/",
         tags=["items"],
         description="Describe List all items",
         summary="Summary of List all items ",
         response_model=List[Item]
         )
async def read_items(q: Union[List[str], None] = Query(default=None)):
    query_items = {"q": q}
    return query_items


if __name__ == '__main__':
    uvicorn.run(app, host='127.0.0.1', port=8000)
